using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Article_Vote - 投票表 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IArticleVote<T> :ModelBase<ArticleVote> where T : ArticleVote, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.VoteId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return VoteId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.VoteId=dy.VoteId;
           this.ContentId=dy.ContentId;
           this.Explain=dy.Explain;
           this.IsMultiple=dy.IsMultiple;
           this.IsAnonymous=dy.IsAnonymous;
           this.IntervalTime=dy.IntervalTime;
           this.IsMiscellaneous=dy.IsMiscellaneous;
           this.TypeId=dy.TypeId;
        } 

        #region 定义属性

     
         /// <summary>
        /// VoteId
        /// </summary>
        private String _VoteId = "";
      
        /// <summary>
        /// VoteId
        /// </summary>
        public String VoteId
        {
            get 
            {
              return   (this._VoteId); 
            }

            set 
            {
                    _VoteId= value;  
            }
        }
       
     
         /// <summary>
        /// 内容ID
        /// </summary>
        private int _ContentId =int.MinValue;
      
        /// <summary>
        /// 内容ID
        /// </summary>
        public int ContentId
        {
            get 
            {
              return   (this._ContentId); 
            }

            set 
            {
                    _ContentId= value;  
            }
        }
       
     
         /// <summary>
        /// 投票说明
        /// </summary>
        private String _Explain = "";
      
        /// <summary>
        /// 投票说明
        /// </summary>
        public String Explain
        {
            get 
            {
              return   (this._Explain); 
            }

            set 
            {
                    _Explain= value;  
            }
        }
       
     
         /// <summary>
        /// 是否多选
        /// </summary>
        private int _IsMultiple =int.MinValue;
      
        /// <summary>
        /// 是否多选
        /// </summary>
        public int IsMultiple
        {
            get 
            {
              return   (this._IsMultiple); 
            }

            set 
            {
                    _IsMultiple= value;  
            }
        }
       
     
         /// <summary>
        /// 是否可以匿名投票
        /// </summary>
        private int _IsAnonymous =int.MinValue;
      
        /// <summary>
        /// 是否可以匿名投票
        /// </summary>
        public int IsAnonymous
        {
            get 
            {
              return   (this._IsAnonymous); 
            }

            set 
            {
                    _IsAnonymous= value;  
            }
        }
       
     
         /// <summary>
        /// 每次投票的间隔时间
        /// </summary>
        private int _IntervalTime =int.MinValue;
      
        /// <summary>
        /// 每次投票的间隔时间
        /// </summary>
        public int IntervalTime
        {
            get 
            {
              return   (this._IntervalTime); 
            }

            set 
            {
                    _IntervalTime= value;  
            }
        }
       
     
         /// <summary>
        /// 是否包括其他
        /// </summary>
        private int _IsMiscellaneous =int.MinValue;
      
        /// <summary>
        /// 是否包括其他
        /// </summary>
        public int IsMiscellaneous
        {
            get 
            {
              return   (this._IsMiscellaneous); 
            }

            set 
            {
                    _IsMiscellaneous= value;  
            }
        }
       
     
         /// <summary>
        /// 投票类型
        /// </summary>
        private int _TypeId =-1;
      
        /// <summary>
        /// 投票类型
        /// </summary>
        public yq.Enums.ArticleVote.TypeId TypeId
        {
            get 
            {
              return   (yq.Enums.ArticleVote.TypeId)this._TypeId;  
            }

            set 
            {
                    _TypeId= value.GetHashCode(); 
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(ArticleVote info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["VoteId"]!= DBNull.Value)
                  {
                  info.VoteId=row["VoteId"].ToString();
                 }
                 
                  
                  if(row["ContentId"]!= DBNull.Value)
                  {
                  info.ContentId=Convert.ToInt32(row["ContentId"]);
                 }
                 
                  
                  if(row["Explain"]!= DBNull.Value)
                  {
                  info.Explain=row["Explain"].ToString();
                 }
                 
                  
                  if(row["IsMultiple"]!= DBNull.Value)
                  {
                  info.IsMultiple=Convert.ToInt32(row["IsMultiple"]);
                 }
                 
                  
                  if(row["IsAnonymous"]!= DBNull.Value)
                  {
                  info.IsAnonymous=Convert.ToInt32(row["IsAnonymous"]);
                 }
                 
                  
                  if(row["IntervalTime"]!= DBNull.Value)
                  {
                  info.IntervalTime=Convert.ToInt32(row["IntervalTime"]);
                 }
                 
                  
                  if(row["IsMiscellaneous"]!= DBNull.Value)
                  {
                  info.IsMiscellaneous=Convert.ToInt32(row["IsMiscellaneous"]);
                 }
                 
                  
                  if(row["TypeId"]!= DBNull.Value)
                  {
                  info.TypeId=  (yq.Enums.ArticleVote.TypeId)(row["TypeId"]) ;
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, ArticleVote info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@VoteId", DbType.String,ParameterTool.GetObj( info._VoteId )); 
            
             
                cn.AddInParameter(comm, "@ContentId", DbType.Int32,ParameterTool.GetObj( info._ContentId )); 
            
             
                cn.AddInParameter(comm, "@Explain", DbType.String,ParameterTool.GetObj( info._Explain )); 
            
             
                cn.AddInParameter(comm, "@IsMultiple", DbType.Int32,ParameterTool.GetObj( info._IsMultiple )); 
            
             
                cn.AddInParameter(comm, "@IsAnonymous", DbType.Int32,ParameterTool.GetObj( info._IsAnonymous )); 
            
             
                cn.AddInParameter(comm, "@IntervalTime", DbType.Int32,ParameterTool.GetObj( info._IntervalTime )); 
            
             
                cn.AddInParameter(comm, "@IsMiscellaneous", DbType.Int32,ParameterTool.GetObj( info._IsMiscellaneous )); 
            
             
                cn.AddInParameter(comm, "@TypeId", DbType.Int32,ParameterTool.GetObj( info._TypeId )); 
            
        } 

    } 
} 